package com.pc.scrs.controller;

import com.pc.scrs.bean.po.Perms;
import com.pc.scrs.service.IPermsService;
import com.pc.scrs.utils.ResponseResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/perms")
public class PermsController {

    @Resource
    private IPermsService permsService;

    @RequestMapping("/menu")
    public ResponseResult loadMenu(HttpServletRequest request){

        String jwtToken = request.getHeader("jwtToken");
        List<Perms> permsList = permsService.selectPermsByUserName(jwtToken);
        if(permsList!=null){
            return new ResponseResult<>(200, "ok",permsList);
        }else {
            return ResponseResult.FAIL;
        }


    }
}
